package com.abel.manager.impl;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.abel.domain.Person;
import com.abel.domain.SearchCriteria;
import com.abel.manager.SearchManager;
import com.abel.manager.exception.SearchException;
import com.abel.repository.SearchRepository;
import com.abel.repository.exception.RepositoryException;

public class SearchManagerImpl implements SearchManager {

	protected final Log logger = LogFactory.getLog(getClass());
	
	private SearchRepository searchRepository;
	
	@Override
	public List<Person> getApplications(SearchCriteria criteria)
			throws SearchException {

		try {
			
			return this.searchRepository.getApplications(criteria);
		} 
		catch (RepositoryException e) {
			e.printStackTrace();
			throw new SearchException("Exception while fetching data for criteria " + criteria, e);
		}
	}

	
	
	
	@Override
	public void setSearchRepository(SearchRepository searchRepository) {
		
		this.searchRepository = searchRepository;
		
	}

}
